package com.yl.auth.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yl.auth.entity.LaorenTijian;
import com.yl.auth.model.vo.LaoTiVo;
import com.yl.auth.model.vo.LaorenVo;
import com.yl.auth.service.LaorenService;
import com.yl.auth.service.LaorenTijianService;
import com.yl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yl
 * @since 2023-06-19
 */
@RestController
@RequestMapping("/admin/auth/laorenTijian")
@Api(tags = "体检报告")
public class LaorenTijianController {
    @Resource
    private LaorenTijianService laorenTijianService;
    @Resource
    private LaorenService laorenService;

    /**
     * 体检报告分页查询+上传
     */
    @ApiOperation(value = "体检分页")
    @GetMapping("/pages/{id}/{page}/{limit}")
    public Result pages(@PathVariable @ApiParam("页码") Long id,@PathVariable @ApiParam("页码") Long page,
                       @PathVariable @ApiParam("记录") Long limit){
        Page<LaoTiVo> page1=new Page<>(page,limit);
        Page<LaoTiVo> list=laorenTijianService.pages(id,page1);
        return Result.ok(list);
    }

    /**
     * 体检报告查看详情--老人信息(页面上半块儿)
     */
    @ApiOperation(value = "体检报告查看详情--老人信息")
    @GetMapping("/getTijianXiangqing/{id}")
    public Result getTijianLaoren(@PathVariable @ApiParam("老人id") Integer id){

        LaoTiVo laoTiVo=laorenTijianService.getTijianLaoren(id);
        return Result.ok(laoTiVo);
    }

    /**
     * 体检报告查看详情--老人体检信息(页面下半块儿 )
     */
    @ApiOperation(value = "体检报告查看详情--老人体检信息")
    @GetMapping("/getLaoTi/{id}")
    public Result getLaoTi(@PathVariable @ApiParam("老人id") Long id){
        LaoTiVo laoTiVo=laorenTijianService.getLaoTi(id);
        return Result.ok(laoTiVo);
    }

    /**
     * 根据老人id查询老人信息
     */
    @ApiOperation(value = "老人基本信息")
    @GetMapping("/getLao/{id}")
    public Result getLao(@PathVariable @ApiParam("老人id") Long id){
        LaorenVo laorenVo=laorenService.getLao(id);
        return Result.ok(laorenVo);
    }

}

